

package com.hexinfo.dmpro.sparing.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import org.springframework.http.ResponseEntity;
import com.hexinfo.dmpro.sparing.model.UatBlackList;
import com.hexinfo.dmpro.sparing.service.UatBlackListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * UAT黑名单表
 *
 * @author yemw
 * @date 2023-11-29 10:37:27
 */
@RestController
@AllArgsConstructor
@RequestMapping("/api/uatblacklist" )
@Api(value = "uatblacklist", tags = "UAT黑名单表管理")
public class UatBlackListController {

    private final  UatBlackListService uatBlackListService;

    /**
     * 分页查询
     * @param page 分页对象
     * @param uatBlackList UAT黑名单表
     * WrapperEnhancer.like(uatBlackList); //自动拼接存在值sql的方法
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page" )
    public ResponseEntity<Object> getUatBlackListPage(Page page, UatBlackList uatBlackList) {
        return ResponseEntity.ok(uatBlackListService.queryList(page,uatBlackList));
    }


    /**
     * 通过id查询UAT黑名单表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @AnonymousAccess
    public ResponseEntity<Object> getById(@PathVariable("id" ) String id) {
        return ResponseEntity.ok(uatBlackListService.getById(id));
    }

    /**
     * 新增UAT黑名单表
     * @param uatBlackList UAT黑名单表
     * @return R
     */
    @ApiOperation(value = "新增UAT黑名单表", notes = "新增UAT黑名单表")
    @PostMapping
    @AnonymousAccess
    public ResponseEntity<Object> save(@RequestBody UatBlackList uatBlackList) {
        return ResponseEntity.ok(uatBlackListService.saveXG(uatBlackList));
    }

    /**
     * 修改UAT黑名单表
     * @param uatBlackList UAT黑名单表
     * @return R
     */
    @ApiOperation(value = "修改UAT黑名单表", notes = "修改UAT黑名单表")
    @PutMapping
    public ResponseEntity<Object> updateById(@RequestBody UatBlackList uatBlackList) {
        return ResponseEntity.ok(uatBlackListService.updateById(uatBlackList));
    }

    /**
     * 通过id删除UAT黑名单表
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除UAT黑名单表", notes = "通过id删除UAT黑名单表")
    @DeleteMapping("/{id}" )
    public ResponseEntity<Object> removeById(@PathVariable String id) {
        return ResponseEntity.ok(uatBlackListService.removeById(id));
    }

}
